const xhr = new XMLHttpRequest();

xhr.open("GET", "https://jsonplaceholder.typicode.com/todos/1", true);

xhr.addEventListener("readystatechange", function (e) {
  if (this.readyState === xhr.DONE) {
    if (this.status === 200) {
      const json = JSON.parse(this.responseText);
      console.log(json);
    } else {
      console.log("请求失败");
    }
  }
});

xhr.send();
